package com.controller;

import com.common.R;
import com.pojo.User;
import com.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;
    @RequestMapping("/register")
    public String register(){
        return "User注册成功！";
    }

    @GetMapping("/login/{name}")
    public String login(@PathVariable("name") String name){
        return name +"登录成功！";
    }

    @GetMapping("/list")
    public R listAllUsers() {
        return R.ok(userService.listAllUsers());
    }
}
